<?php
namespace app\api\controller;
use app\model\MotifModel;
use app\model\ScoreModel;
use app\model\TopicModel;
use think\facade\Request;

class score{
    public function score_list(){
        session_start();
        $adminid = $_SESSION['admin_id'];
        $sum = Request::param();
        foreach($sum['score'] as $time){
            $result =ScoreModel::create([
                'admin_id' => $adminid,
                'motif_id' => $sum['motifid'],
                'scores' => $time
            ]);
        }
        if($result){
            $data = [
                'status' => 0,
                'message' => '提交成功',
                'data' => [$sum]
            ];
            return json($data);
        }else{
            $data = [
                'status' => 10001,
                'message' => '提交失败',
                'data' => []
            ];
            return json($data);
        }

    }
}